package com.tomcat.server;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

/**
 * desc: 线程池
 *
 * @author tengfei wang
 * @version 1.0
 * @date Created in 25/9/2020
 */
public class RequestThreadPool {

    private static final int corePoolSize = 8;
    private static final int maximumPoolSize = 16;
    private static final long keepAliveTime = 1;

    public static ThreadPoolExecutor getThreadPool() {
        return new ThreadPoolExecutor(corePoolSize, maximumPoolSize, keepAliveTime, TimeUnit.MINUTES, new ArrayBlockingQueue<Runnable>(50));
    }

    public static void main(String[] args) {
        ThreadPoolExecutor threadPool = RequestThreadPool.getThreadPool();
    }
}
